package com.treasure.domain.velocity;


import java.io.IOException;
import java.util.Map;

/**
 * @author sunhongmin
 * @date 2022/9/1 18:13
 * @description
 */
public interface TemplateEngine {

    /**
     * 解析模版
     * 基于反射将字段值转化为 key-value
     *
     * @param templateName
     * @param velocityContextBean
     * @param <T>
     * @throws IOException
     * @throws IllegalAccessException
     */
    <T> String writeDocument(String templateName, T velocityContextBean) throws IOException, IllegalAccessException;


    /**
     * 解析模版
     * 自定义map结构context
     * @param templateName
     * @param keyValue
     * @return
     * @throws IOException
     */
    String writeDocument(String templateName, Map<String, Object> keyValue) throws IOException;

}
